home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / AE Stuff / CFinderEvent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  2.6 KB  |  89 lines  |  [TEXT/KAHL]

  1. /*
  2.  * ---------------------------------------------------------------------
  3.  * CFinderEvent.h :
  4.  *
  5.  * Based on Jon Pugh Finder Event code
  6.  *
  7.  * © Copyright 1992 by F. Menneteau.  All rights reserved.
  8.  * This code can be both distributed and used freely.
  9.  *
  10.  * ---------------------------------------------------------------------
  11.  */
  12.  
  13.  
  14. #pragma once
  15.  
  16. #include "CGenericAE.h"
  17.  
  18.  
  19.     // IM VI says: "[...] typically 200 to 300 bytes"
  20. #define MAX_ALIAS_SIZE        300
  21.  
  22. /*
  23.  *    When an AliasRecord is created, it contains a visible fixed part, and
  24.  *    an invisible dynamic one (see IM VI for more information).
  25.  *
  26.  *    When you declare an AliasRecord, the compiler only allocates room
  27.  *    for the visible part. So if you get an AliasRecord (after a call to
  28.  *    NewAlias for example), you cannot assign it directly to the alias
  29.  *    field of the FinderRecord. Thus, you need to allocate a buffer of size:
  30.  *    (**MyAlias).aliasSize - sizeof(aliasRecord), just after the structure.
  31.  *
  32.  *    In order to avoid dynamic allocation, we use the following structure,
  33.  *    which is the concatenation of a FinderWindow and a buffer that emulates
  34.  *    the invisible dynamic part of the aliasRecord.
  35.  *
  36.  *    Note that we use the !align_arrays pragma option to be sure fData is
  37.  *    just after the FinderWindow structure even if it is odd (which is at
  38.  *    present not the case).
  39.  */ 
  40.  
  41. #pragma options(!align_arrays)
  42.  
  43. typedef struct {
  44.     FinderWindow    fFinderWindow            ;
  45.     char            fData[MAX_ALIAS_SIZE]    ;
  46. } FakeFinderWind ;
  47.  
  48. #pragma options(align_arrays)
  49.  
  50.  
  51. class CFinderEvent : public CGenericAE {
  52. private:
  53.     OSErr         privFakeHideEventPutParam(OSType) ;
  54.     OSErr         privWindowPathPutParam(Ptr, WindowType);
  55. protected:
  56.  
  57. public:
  58.     OSErr        IFinderEvent(void);
  59.     OSErr        IRemoteFinderEvent(Ptr);
  60.  
  61.     OSErr        FESendAbout(void);
  62.     OSErr        FESendAliasSelection(Ptr, Ptr);
  63.     OSErr        FESendCloseAbout(void);
  64.     OSErr        FESendCloseWindow(Ptr, WindowType);
  65.     OSErr        FESendDragSelection(Ptr, Ptr, short, short);
  66.     OSErr        FESendDuplicateSelection(Ptr, Ptr);
  67.     OSErr        FESendEmptyTrash(void);
  68.     OSErr        FESendGetInfo(Ptr, Ptr);
  69.     OSErr        FESendHideClipboard(void);
  70.     OSErr        FESendMoveSelection(Ptr, Ptr, short, short);
  71.     OSErr        FESendMoveWindow(Ptr, short, short);
  72.     OSErr        FESendOpenSelection(Ptr, Ptr);
  73.     OSErr        FESendPageSetup(Ptr);
  74.     OSErr        FESendPrintSelection(Ptr, Ptr);
  75.     OSErr        FESendPrintWindow(Ptr);
  76.     OSErr        FESendPutAway(Ptr, Ptr);
  77.     OSErr        FESendResizeWindow(Ptr, short, short);
  78.     OSErr        FESendRestart(void);
  79.     OSErr        FESendRevealSelection(Ptr, Ptr);
  80.     OSErr        FESendSetView(Ptr, TypeWindowView);
  81.     OSErr        FESendSharing(Ptr, Ptr);
  82.     OSErr        FESendShowClipboard(void);
  83.     OSErr        FESendShutDown(void);
  84.     OSErr        FESendSleep(void);
  85.     OSErr        FESendZoomWindow(Ptr, TypeWindowZoom);
  86. } ;
  87.  
  88.  
  89.